SeasonAdmin = {
	createLeague : function() {
		$('Form_EditForm').getPageFromServer(21);
		return false;
	}

}



Behaviour.addLoader(function () {
	if ($('Form_EditForm_action_createLeague'))
		$('Form_EditForm_action_createLeague').onclick = SeasonAdmin.createLeague;	

	//$('Form_EditForm').getPageFromServer(21);
	//http://foul.chw/admin/getitem?ID=21&ajax=1
});

CMSRightForm.prototype.loadURLFromServer = function(url) {
	var urlParts = url.match( /ID=(\d+)/ );
	var id = urlParts ? urlParts[1] : null;
	
	if( !url.match( /^https?:\/\/.*/ ) )
		url = document.getElementsByTagName('base')[0].href + url;
	
	new Ajax.Request( url + '&ajax=1', {
		asynchronous : true,
		onSuccess : function( response ) {
			$('Form_EditForm').successfullyReceivedPage(response,id);
			if ($('Form_EditForm_action_createLeague'))
				$('Form_EditForm_action_createLeague').onclick = SeasonAdmin.createLeague;
		},
		onFailure : function(response) { 
			alert(response.responseText);
			errorMessage('error loading page',response);
		}
	});
}
